Skip to content

Conversation

kailan
Copy link
Contributor

@kailan kailan commented Jul 26, 2025

This PR is split from #11629 – it contains just the database schema-related changes, with no changes to the API, frontend, or any user-visible behaviour, barring a change to the description of three properties of the /api/v1/me response in the OpenAPI schema.

I previously had a note here about it being possible for an email address to exist on more than one user account, but this is the current behaviour in production so I have removed it.

Relates to #11597.

@kailan kailan force-pushed the multiple-emails-schema branch 3 times, most recently from f6ebfe0 to 77ebf49 Compare July 26, 2025 14:25
@kailan kailan force-pushed the multiple-emails-schema branch from 77ebf49 to edf516e Compare July 26, 2025 14:27
@kailan kailan marked this pull request as ready for review July 26, 2025 14:38
Comment on lines 27 to 28
-- Set `is_primary` to true for existing emails
UPDATE emails SET is_primary = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we currently have 72k rows in the emails table. I'm a bit scared about running this as part of the migration, since the running migration will block the API server from restarting.

@eth3lbert any thoughts on this?

I guess we could extract the add column is_primary above to a dedicated migration/PR, deploy that to run the migration, then manually run the update is_primary = true without blocking the API server, and then merge/deploy the rest of this migration 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could extract the add column is_primary above to a dedicated migration/PR, deploy that to run the migration, then manually run the update is_primary = true without blocking the API server, and then merge/deploy the rest of this migration 🤔

Yeah, I second this! I think this would be the most proper way to minimize potential issues caused by the introduced database migration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split this into a separate migration and will open a separate PR including just that.

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Aug 4, 2025
@kailan
Copy link
Contributor Author

kailan commented Aug 28, 2025

Haven't forgotten about this! Thanks for your review – aiming to address your comments soon.

@kailan kailan marked this pull request as draft October 10, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants